package jdbc.stu7_29;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import jdbc.dbconfig.DBConfig;

public class FirstJdbc {

	private static Connection con = null;
	private static Statement stm = null;
	private static ResultSet rs = null;
	private static String sql = "select * from bank";

	public static void main(String[] args) throws Exception {
		Class.forName(DBConfig.getClassDriver());
		con = DriverManager.getConnection(DBConfig.getUrl(), DBConfig.getUser(), DBConfig.getPwd());
		stm = con.createStatement();
		rs = stm.executeQuery(sql);
		System.out.println("id\tmoney");
		while (rs.next()) {
			System.out.print(rs.getString(1) + "\t");
			System.out.println(rs.getDouble(2));
		}
		rs.close();
		stm.close();
		con.close();
	}
}
